<?php defined('_JEXEC') or die('Restricted access'); 
JHTML::_('behavior.tooltip');
$document =& JFactory::getDocument();

jimport('joomla.filesystem.file');
$lang =& JFactory::getLanguage();
$component = JComponentHelper::getComponent( 'com_properties' );
$params = new JParameter( $component->params );
$MostrarCarousel=$params->get('MostrarCarousel');
$ActivarMapa=$params->get('ActivarMapa');
$Can_publish=$params->get('cantidad_productos_publicar');
if(!JRequest::getVar('id_categoria')){$id_categoria = 0;}
else{
$id_categoria = JRequest::getVar('id_categoria');
}
//echo '$idcategoriaaaa : '.$id_categoria;
$Itemid = JRequest::getVar('Itemid'); 
?>
<script type="text/javascript">
function irUrlNew(){
document.getElementById('task').value = 'new';
window.location.href='<?php echo JRoute::_( 'index.php?option=com_properties&view=panel' );?>';
}		
</script>


<form action="<?php echo JRoute::_( 'index.php?option=com_properties')?>" method="post" name="adminForm">
<?php

if($user->gid == 50){
$Can_publish=($this->DataThisAgent->type);
}
//echo 'cp: '.$Can_publish.' cant: '.$this->Cant_items;
if($Can_publish > $this->Cant_items ){

?>
<div class="titulo"><H3><?php echo JText::_('My Panel'); ?></H3></div>
	<div class="botones">
<div class="boton">
<!-- Thuan edit button style-->
<button class="mbutton_new" onclick="irUrlNew();"><span class="txt"><?php echo JText::_('New'); ?></span></button>
<!-- Thuan edit end-->
</div>
</div>
<?php
}
?>
<div style="clear:both;"></div>

<div id="propiedades" >
<div style="text-align:center; margin-bottom:20px; "><?php echo $this->Cant_items.' '.JText::_('properties you have posted a total of').' : '.$Can_publish; ?></div>
<?php
    $k = 0;
	for ($i=0, $n=count( $this->items ); $i < $n; $i++)	
    {

$row = &$this->items[$i];	
		$link 		= JRoute::_( 'index.php?option=com_properties&view=property&catid='.$row->catslug.'&id='.$row->slug);
		
		?>
        
<?php
$watermark='DETAILS_MARKET'.$row->available.'-'.$lang->getTag().'.png';

if($row->image1!=NULL){ $img=$row->image1;}else{$img='noimage.jpg';}
$destino_imagen = JPATH_SITE.DS.'images'.DS.'properties'.DS.'peques'.DS.'peque_'.$img;
if (JFile::exists($destino_imagen)){



$InfoImage=getimagesize($destino_imagen);               
                $width=$InfoImage[0];
                $height=$InfoImage[1];
				
	//echo	$width.$height;

$imgTag='<img src="images/properties/peques/peque_'. $img .'" alt="'. $row->name .'" height="75" />';
 
 }else{$imgTag='<img src="images/properties/peques/peque_'. $img .'" />';}
?>

<div class="producto_2" >     

     <div class="detalles_2">
<div class="imagendetalles_2">
<div class="watermark_box">

<?php echo $imgTag;?>
<img src="<?php echo JURI::base().'/components/'.'com_properties/'.'includes/'.'img/'.$watermark; ?>" class="watermark" alt="<?php echo JText::_('DETAILS_MARKET'.$row->available); ?>">

 </div>
</div>
<div class="datos_2">
<?php 
$status = 'status=no,toolbar=no,scrollbars=yes,titlebar=no,menubar=no,resizable=yes,width=600,height=600,directories=no,location=no';?>
<span class="editlinktip hasTip" title="<?php echo JText::_('Preview'); ?>::<?php echo $row->name; ?>">
<a href="javascript:void(0)" onclick="window.open('<?php echo JURI::base().'index.php?option=com_properties&view=property&tmpl=component&id='.$row->id; ?>','win2','<?php echo $status; ?>');" >
<?php echo $row->name; ?></a>
</span>
<br />
<?php echo JText::_('Category'); ?>: <?php echo $this->NameCategory[$row->parent]; ?><br />
<?php echo JText::_('Type'); ?>: <?php echo $this->NameType[$row->type]; ?><br />
<?php echo JText::_('Locality'); ?>: <?php echo $this->NameLocality[$row->lid]; ?><br /> 


			   </div>
  </div> 
 <div class="links_2">
<?php $link = JRoute::_( 'index.php?option=com_properties&view=panel&task=edit&id='.$row->id.'&Itemid='.$Itemid);	?>	
<span class="editlinktip hasTip" title="<?php echo JText::_('Edit'); ?>::<?php echo $row->name; ?>">
<a href="<?php echo $link;?>"><img src="<?php echo JURI::base().'components/com_properties/includes/img/icon-32-edit.png';?>" />
</a>  
</span>   

<span class="editlinktip hasTip" title="<?php echo JText::_('Delete'); ?>::<?php echo $row->name; ?>">
<a href="<?php echo JRoute::_('index.php?option=com_properties&view=panel&task=delete&id='.$row->id.'&Itemid='.$Itemid);?>">
<img src="<?php echo JURI::base().'components/com_properties/includes/img/delete.png';?>" />
</a>  
</span>                      

<?php
$published = CatTreeHelper::PublishedPanel( $row, 1);
 //$published 	= JHTML::_('grid.published', $row, 1 );?>
<?php echo $published;?>
<?php echo $show;?>

 </div>
              
</div>  <!--producto --> 
  <div style="clear:both"></div> 
<?php
$k = 1 - $k;
}
 ?>
<div class="paginacion" style="">
<div class="left" style="float:left;">
	  <?php echo $this->pagination->getPagesLinks(); ?>
      </div>      
      <div class="limit" style="float:left;padding: 12px 0px 0px 10px;margin: 15px auto;background: url(templates/ja_purity/images/hdot.gif) repeat-x top;">
      <?php echo $this->pagination->getResultsCounter().' | '.$this->pagination->getPagesCounter(); ?>
      </div>
<br style="clear: both;" /> 
</div><!-- paginacion--> 
</div><!-- propiedades-->
<input type="hidden" name="option" value="com_properties" />
<input type="hidden" name="task" value="new" />
<input type="hidden" name="view" value="panel" />
<input type="hidden" name="boxchecked" value="0" />
<input type="hidden" name="filter_order" value="<?php echo $this->lists['order']; ?>" />
<input type="hidden" name="filter_order_Dir" value="<?php echo $this->lists['order_Dir']; ?>" />
<input type="hidden" name="controller" value="" />
<?php echo JHTML::_( 'form.token' ); ?>
</form>